#include "MiscUtil.hpp"

namespace kieper {
    namespace miscutil {
        void setBit16(uint16_t& chomp, unsigned int bitNum) {
            chomp |= (1 << bitNum);
        }
        
        void clearBit16(uint16_t& chomp, unsigned int bitNum) {
            chomp &= ~(1 << bitNum);
        }

        void setBitValue16(uint16_t& chomp, unsigned int bitNum, unsigned int value) {
            if (value) {
                setBit16(chomp, bitNum);
            } else {
                clearBit16(chomp, bitNum);
            }
        }

        unsigned int getBitValue16(uint16_t chomp, unsigned int bitNum) {
            if (chomp & (1 << bitNum)) {
                return 1;
            } else {
                return 0;
            }
        }
    }
}
